<?php
namespace app\admin\validate;

use think\Validate;

class Article extends Validate
{
    protected $rule =   [
        'title'  => 'require|unique:article|max:25',
        'cateid'   => 'require',
        'author'  =>'require',
           
    ];

    protected $message  =   [
        'title.require' => '文章标题不得为空！',        
        'cateid.require' => '文章所属栏目不得为空！',        
        'author.require' => '文章作者不得为空！',        
        'title.max'     => '文章标题最多不能超过25个字符',
        'title.unique'  => '文章标题不得重复！', 

    ];

    protected $scene = [
        'edit'  =>  ['title'=>'require|max:25','author'],
        'add' =>['title','author','cateid'],
    ];

}